package sudroid.android.app;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.ContextWrapper;
import android.database.Cursor;
import android.net.Uri;
import java.util.ArrayList;
import sudroid.AssertUtil;

public class Calendar
{
  public static void addEvent(ContextWrapper paramContextWrapper, Event paramEvent)
  {
    AssertUtil.checkNull(paramContextWrapper);
    AssertUtil.checkNull(paramEvent);
    ContentValues localContentValues = new ContentValues();
    Integer localInteger1 = Integer.valueOf(paramEvent.calendarID);
    localContentValues.put("calendar_id", localInteger1);
    String str1 = paramEvent.title;
    localContentValues.put("title", str1);
    String str2 = paramEvent.description;
    localContentValues.put("description", str2);
    String str3 = paramEvent.eventLocation;
    localContentValues.put("eventLocation", str3);
    Long localLong1 = Long.valueOf(paramEvent.dtstart);
    localContentValues.put("dtstart", localLong1);
    Long localLong2 = Long.valueOf(paramEvent.dtend);
    localContentValues.put("dtend", localLong2);
    if (paramEvent.allDay)
    {
      Integer localInteger2 = Integer.valueOf(1);
      localContentValues.put("allDay", localInteger2);
    }
    while (true)
    {
      Uri localUri1 = Uri.parse("content://calendar/events");
      Uri localUri2 = paramContextWrapper.getContentResolver().insert(localUri1, localContentValues);
      return;
      Integer localInteger3 = Integer.valueOf(0);
      localContentValues.put("allDay", localInteger3);
    }
  }

  public static ArrayList<Account> getCalendarAccounts(Activity paramActivity)
  {
    String[] arrayOfString1 = new String[3];
    arrayOfString1[0] = "_id";
    arrayOfString1[1] = "name";
    arrayOfString1[2] = "access_level";
    Uri localUri = Uri.parse("content://calendar/calendars");
    Activity localActivity = paramActivity;
    String[] arrayOfString2 = null;
    String str1 = null;
    Cursor localCursor = localActivity.managedQuery(localUri, arrayOfString1, null, arrayOfString2, str1);
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2;
    if ((localCursor != null) && (localCursor.moveToFirst()))
    {
      do
      {
        int i = localCursor.getColumnIndex("_id");
        int j = localCursor.getInt(i);
        int k = localCursor.getColumnIndex("name");
        String str2 = localCursor.getString(k);
        int m = localCursor.getColumnIndex("access_level");
        if (localCursor.getInt(m) != 700)
          continue;
        Account localAccount = new Account();
        localAccount.accountName = str2;
        localAccount.id = j;
        boolean bool = localArrayList1.add(localAccount);
      }
      while (localCursor.moveToNext());
      if (isDefaultAccount(localArrayList1))
        localArrayList2 = null;
    }
    while (true)
    {
      return localArrayList2;
      localArrayList2 = localArrayList1;
      continue;
      localArrayList2 = null;
    }
  }

  private static boolean isDefaultAccount(ArrayList<Account> paramArrayList)
  {
    if ((paramArrayList != null) && (paramArrayList.size() != 0) && (paramArrayList.size() == 1) && (((Account)paramArrayList.get(0)).accountName == null));
    for (int i = 1; ; i = 0)
      return i;
  }

  public class Account
  {
    public String accountName;
    public int id;
  }

  public class Event
  {
    boolean allDay;
    int calendarID;
    String description;
    long dtend;
    long dtstart;
    String eventLocation;
    String title;

    private Event()
    {
      this.description = "";
      this.eventLocation = "";
      this.allDay = 0;
    }

    public Event(String paramLong1, long arg3, long arg5)
    {
      this();
      this.calendarID = this$1;
      this.title = paramLong1;
      this.dtstart = ???;
      Object localObject;
      this.dtend = localObject;
    }

    public Event(String paramString1, String paramString2, String paramLong1, long arg5, long arg7)
    {
      this.calendarID = this$1;
      this.title = paramString1;
      this.description = paramString2;
      this.eventLocation = paramLong1;
      this.dtstart = ???;
      Object localObject;
      this.dtend = localObject;
    }

    public Event(String paramString1, String paramString2, String paramLong1, long arg5, long arg7, boolean arg9)
    {
      this.calendarID = this$1;
      this.title = paramString1;
      this.description = paramString2;
      this.eventLocation = paramLong1;
      this.dtstart = ???;
      Object localObject1;
      this.dtend = localObject1;
      Object localObject2;
      this.allDay = localObject2;
    }

    public int getCalendarID()
    {
      return this.calendarID;
    }

    public String getDescription()
    {
      return this.description;
    }

    public long getDtend()
    {
      return this.dtend;
    }

    public long getDtstart()
    {
      return this.dtstart;
    }

    public String getEventLocation()
    {
      return this.eventLocation;
    }

    public String getTitle()
    {
      return this.title;
    }

    public boolean isAllDay()
    {
      return this.allDay;
    }

    public void setAllDay(boolean paramBoolean)
    {
      this.allDay = paramBoolean;
    }

    public void setCalendarID(int paramInt)
    {
      this.calendarID = paramInt;
    }

    public void setDescription(String paramString)
    {
      this.description = paramString;
    }

    public void setDtend(long paramLong)
    {
      this.dtend = paramLong;
    }

    public void setDtstart(long paramLong)
    {
      this.dtstart = paramLong;
    }

    public void setEventLocation(String paramString)
    {
      this.eventLocation = paramString;
    }

    public void setTitle(String paramString)
    {
      this.title = paramString;
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.android.app.Calendar
 * JD-Core Version:    0.6.0
 */